-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nixos/nginx: make sslCertificate and sslCertificateKey nullable #40932
Conversation
One drawback is a confusing error message when the user enables SSL but doesn't set the certificate paths. Most users wouldn't understand what's wrong here:
Before this PR, the message was much clearer:
|
Maybe the error message can be improved by adding an assertion. |
That comes at a price of not being able to refer to these options in |
To be clear, here's what I'm doing: { config, lib, ... }:
with lib;
let
inherit (config.networking) hostName;
overrideVirtualHost = name: vhost: vhost // ({
forceSSL = true;
}) // (optionalAttrs (vhost.sslCertificate == null) {
enableACME = true;
}) // (optionalAttrs (vhost.serverName == null) {
serverName = "${name}.${hostName}";
});
in
{
options.services.nginx.virtualHosts = mkOption {
apply = vhosts: mapAttrs overrideVirtualHost vhosts;
};
} |
Can't you use |
@dotlambda I don't think that would work:
|
Why not?
|
Huh, that worked. Thank you a lot! |
Hm, actually it did not:
I just changed |
Any progress on this ? |
Are there any updates on this pull request, please? |
Closing due to inactivity. |
This doesn't change any behavior, but extraordinarily simplifies
virtualHost
override viaoptions.services.nginx.virtualHosts.apply
.